﻿@{
    Layout = null;
}
@model ElingOA6_Admin_DSJCJ.Model.PeerReviewBeenVoterCls
<!DOCTYPE html>
<html>
@Html.Partial("LoadPanelPartial")
<head>
    <title>GroupEdit</title>
        @if (false)
    {
        <script src="../../../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
    }
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/FloatDiv.js", true)" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/PageCommon.js", true)" type="text/javascript"></script>
     <script src="@Url.Content("~/Scripts/json2.js", true)" type="text/javascript"></script>
      <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>   
    @Html.DevExpress().GetStyleSheets(

        new StyleSheet { ExtensionType = ExtensionType.ListBox, Theme = DevExpressHelper.Theme }
)
    @Html.DevExpress().GetScripts(
        new Script { ExtensionType = ExtensionType.ListBox }
)
    <script type="text/javascript">
        $(document).ready(function () {
            var hdjsAlert = $("#hdMessage").val();
            if (hdjsAlert != "") {
                alert(hdjsAlert);
                window.location.href = rootPath + "/Admin/PeerReviewBeenVoterCls/PeerReviewBeenVoterClsList";
            }
        });

        function MenuTop_emClick(source, e) {
            switch (e.item.name) {
                case "btnSave":
                    {
                        //保存
                        save();
                        break;
                    }
                case "btnCancel":
                    {
                        //返回
                        window.location.href = rootPath + "/Admin/PeerReviewBeenVoterCls/PeerReviewBeenVoterClsList";
                        break;
                    }
            }
        }

        function save() {
            var FBeenVoterClsCd = ASPxClientTextBox.Cast("FBeenVoterClsCd");
            if (FBeenVoterClsCd.GetText() == "") {
                FBeenVoterClsCd.SetErrorText("该输入项不能为空！");
                FBeenVoterClsCd.SetIsValid(false);
                return;
             }
            var FBeenVoterClsName = ASPxClientTextBox.Cast("FBeenVoterClsName");
            if (FBeenVoterClsName.GetText() == "") {
                FBeenVoterClsName.SetErrorText("该输入项不能为空！");
                FBeenVoterClsName.SetIsValid(false);
                return;
            }
            var FDispSeq = ASPxClientTextBox.Cast("FDispSeq");
            if (FDispSeq.GetText() == "") {
                FDispSeq.SetErrorText("该输入项不能为空！");
                FDispSeq.SetIsValid(false);
                return;
            }
            var FPeerReviewID = ASPxClientTextBox.Cast("FPeerReviewID");
            if (FPeerReviewID.GetText() == "") {
                FPeerReviewID.SetErrorText("该输入项不能为空！");
                FPeerReviewID.SetIsValid(false);
                return;
            }

            form1.submit();

         }


        function valueChanged() {
            var FDispSeq = ASPxClientTextBox.Cast("FDispSeq");
            var reg = /^[-+]?\d+$/;
            if (!reg.test(FDispSeq.GetText())) {
                FDispSeq.SetErrorText("只能输入为整数的数字");
                FDispSeq.SetIsValid(false);
                FDispSeq.SetText("");
            }
        }

        function ISExists() {
            var FBeenVoterClsCd = ASPxClientTextBox.Cast("FBeenVoterClsCd");
            var hdPeerReviewID = $("#hdPeerReviewID").val();
            $.ajax({
                type: 'POST',
                url: rootPath + '/Admin/PeerReviewBeenVoterCls/Exists',
                data: { beenVoterClsCd: FBeenVoterClsCd.GetText(), peerReviewID: hdPeerReviewID },
                success: function (result) {
                    if (result == "exists") {
                        FBeenVoterClsCd.SetErrorText("类别编号已存在，请重新输入");
                        FBeenVoterClsCd.SetIsValid(false);
                        FBeenVoterClsCd.SetText("");
                    }
                }
            });
        }
    </script>
</head>
<body>
@using (Html.BeginForm("Save", "PeerReviewBeenVoterCls", FormMethod.Post, new { id = "form1" }))
{ 
        <div class="floatToolMenu" id="toolMenu">
            @Html.DevExpress().Menu(settings =>
      {
          settings.Name = "toolBarMenu";
          settings.ItemAutoWidth = false;
          settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
          settings.Styles.Style.Border.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(0);
          settings.Styles.Style.BorderTop.BorderWidth = System.Web.UI.WebControls.Unit.Pixel(1);

          settings.Items.Add(item =>
          {
              item.Name = "btnSave";
              item.Text = "保存";
              item.ClientEnabled = true;
              item.Image.Url = Url.Content("~/Content/ControlImages/filesave.png");

          });
          settings.Items.Add(item =>
          {
              item.Name = "btnCancel";
              item.Text = "取消";
              item.ClientEnabled = true;
              item.Image.Url = Url.Content("~/Content/ControlImages/no.png");

          });
          settings.ClientSideEvents.ItemClick = "function(source,e){MenuTop_emClick(source,e)}";
          settings.ItemLinkMode = ItemLinkMode.ContentBounds;
      }).GetHtml()
        </div>
    <table class="tableFrom" align="center">
            <tr>
                <td style="text-align: right;"width="15%">
                    被评选人类别编码:</td>
                <td style="text-align: left;" width="85%">
                     @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "FBeenVoterClsCd";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(96);
                   settings.Text = Model.FBeenVoterClsCd;
                   settings.Enabled = (bool)ViewData["ClsCd"];
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
                   settings.Properties.ClientSideEvents.KeyUp = "function(s,e){ISExists()}";
               }).GetHtml()       
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    被评选人类别名称:</td>
                <td style="text-align: left;">
                    @Html.DevExpress().TextBox(settings => 
                   {
                       settings.Name = "FBeenVoterClsName";
                       settings.Text = Model.FBeenVoterClsName;
                       settings.Width = System.Web.UI.WebControls.Unit.Percentage(96);
                       settings.Enabled = true; ;
                       settings.Properties.ValidationSettings.EnableCustomValidation = true;
                        
                   }).GetHtml()
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    显示顺序:</td>
                <td style="text-align: left;">
                    @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "FDispSeq";
                   settings.Width = System.Web.UI.WebControls.Unit.Percentage(96);
                   settings.Text = Model.FDispSeq.ToString();
                   settings.Enabled = true; ;
                   settings.Properties.ValidationSettings.EnableCustomValidation = true;
                   settings.Properties.ClientSideEvents.ValueChanged = "function(s,e){valueChanged()}";
               }).GetHtml()    
                </td>
            </tr>
           <tr>
            <td style="text-align: right;">
                    评议主题:</td>
                <td style="text-align: left;">
                @Html.DevExpress().ComboBox(settings =>
           {
               settings.Name = "FPeerReviewID";
               settings.Properties.DropDownStyle = DropDownStyle.DropDownList;
               settings.Width = System.Web.UI.WebControls.Unit.Percentage(91);
               settings.Enabled = (bool)ViewData["ReviewID"];
               settings.Properties.TextField = "Text";
               settings.Properties.ValueField = "Value";
           }).BindList(ViewData["List"]).Bind(ViewData["PeerReviewID"]).GetHtml()
                </td>
            </tr>
    
    </table>
    @Html.Hidden("hdtype", ViewData["type"])
    @Html.Hidden("hdMessage", ViewData["message"])
    @Html.Hidden("hdPeerReviewID", ViewData["PeerReviewID"])
    
}

</body>
</html>

